package org.siqisource.webstart.tools.proxy;

import java.io.File;

public class Apache {

	public static final String APACHE_FOLDER = "Apache22";

	public static final String APACHE_HOME = System.getProperty("user.dir") + "/" + APACHE_FOLDER;

	public static final String APACHE_WORKFILE = APACHE_HOME + "/bin";

	public static final String APACHE_HTTPD = APACHE_WORKFILE + "/startup.bat";;

	public static void prepare() {
		File apacheDir = new File(Apache.APACHE_HOME);
		if (!apacheDir.exists() && !apacheDir.isDirectory()) {
			AppUtil.extractApache();
		}
	}

	public static void start() {
		try {
			Runtime.getRuntime().exec(APACHE_HTTPD, null, new File(APACHE_WORKFILE));
		} catch (Exception e) {
			System.out.println(e.getLocalizedMessage());
		}
	}

}
